
<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">定时任务设置</div>
                            </div>
                            <div class="am-form-group ">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">任务名称 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="text" class="am-form-field am-radius " name="row[title]" required style="width:500px">
                                    </div>

                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">任务类型</label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <select name="row[type]" required
                                            data-am-selected="{searchBox: 1, btnSize: 'sm',
                                             placeholder:'请选择类型', maxHeight: 400}" style="width:500px">
                                        <option value=""></option>
                                        <?php if (isset($type)): foreach ($type as $key=>$item): ?>
                                            <option value="<?= $key ?>"><?= $item ?></option>
                                        <?php endforeach; endif; ?>
                                    </select>

                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">内容 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <!-- 加载编辑器的容器 -->
                                    <textarea id="container" rows="5" cols="3" name="row[content]" style="width:500px" ></textarea>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label">执行周期</label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <input type="text" class="tpl-form-input" id="schedule" style="width:500px;font-size:12px;font-family: Verdana;word-spacing:23px;" name="row[schedule]" value="* * * * *" required  onchange="CheckSchedule(this.value)"/>
                                </div>

                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label"></label>
                                <div class="am-u-sm-9 am-u-end">
                                    <div id="schedulepicker" style="width: 500px">
                <pre><code>*    *    *    *    *
-    -    -    -    -
|    |    |    |    +--- day of week (0 - 7) (Sunday=0 or 7)
|    |    |    +-------- month (1 - 12)
|    |    +------------- day of month (1 - 31)
|    +------------------ hour (0 - 23)
+----------------------- min (0 - 59)</code></pre>
                                        <h5>接下来<input type="number" id="pickdays" class="form-control text-center" value="7" style="display: inline-block;width:80px;">次的执行时间</h5>
                                        <ol id="scheduleresult" class="list-group">
                                        </ol>
                                    </div>
                                </div>


                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">最多执行</label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <input type="number" class="tpl-form-input" name="row[maximums]" value="0"  size="6" style="width:500px" required>
                                </div>
                            </div>
                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 开始时间 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">

                                    <input type="text" class="j-laydate-start am-form-field"
                                           name="model[start_time]"
                                           style="width:500px"
                                           required>

                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">结束时间</label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <input type="text" class="j-laydate-end am-form-field" name="row[endtime]" style="width:500px" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">权重</label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <input type="number" class="" name="row[weigh]" value="0"  style="width:500px" required>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">状态 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="row[status]" value="1" data-am-ucheck checked>启用
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="row[status]" value="4" data-am-ucheck>禁用
                                    </label>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>

<script src="assets/common/plugins/laydate/laydate.js"></script>
<script src="assets/store/js/select.data.js?v=<?= $version ?>"></script>
<script>
    $(function () {

        // 时间选择器
        laydate.render({
            elem: '.j-laydate-start'
            , type: 'datetime'
        });
        // 时间选择器
        laydate.render({
            elem: '.j-laydate-end'
            , type: 'datetime'
        });
        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();

    });
</script>
